package com.example.oauth2.config;

import com.example.oauth2.domain.JiuBoDouTokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.provider.token.store.redis.RedisTokenStore;

/**
 * @ClassName TokenServiceConfig
 * @Description
 * @Author huyingliang
 * @Date 2024-03-06 17:38
 */
@Configuration
public class TokenServiceConfig {

    @Autowired
    private RedisTokenStore redisTokenStore;

    @Bean
    public JiuBoDouTokenService jiuBoDouTokenService() {
        JiuBoDouTokenService jiuBoDouTokenService = new JiuBoDouTokenService();
        jiuBoDouTokenService.setSupportRefreshToken(true);
        jiuBoDouTokenService.setTokenStore(redisTokenStore);
        return jiuBoDouTokenService;
    }
}
